package tugas.akhir.jason;


import tugas.akhir.jason.dr4_penyebabkerusakan;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

public class dr3_asuransi extends Activity{

    private String labelId, labelAlamat;
	private Button simpan;
	private CheckBox dr3cbx_asuransibangunan;
	private CheckBox dr3cbx_asuransibarangpersonal;
	private CheckBox dr3cbx_asuransijiwa;
	private CheckBox dr3cbx_tidakada;
	private CheckBox dr3cbx_tidakdiketahui;
	Button next_button4;
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dr3_asuransi); 
        
        TextView rid = (TextView) findViewById (R.id.dr2_reportid_label);
        labelId = "ID Laporan: " + variabelstatis.idglobal;
        rid.setText (labelId);
        
        //alamat
        TextView address = (TextView) findViewById (R.id.dr2_address_label);
        labelAlamat = "Alamat: " + variabelstatis.alamatglobal;
        address.setText (labelAlamat);
  
        simpan = (Button)this.findViewById(R.id.next_button4);
        simpan.setOnClickListener(onSave);
        
        dr3cbx_asuransibangunan = (CheckBox)this.findViewById(R.id.dr3cbx_asuransibangunan);
        dr3cbx_asuransibarangpersonal = (CheckBox)this.findViewById(R.id.dr3cbx_asuransibarangpersonal);
        dr3cbx_asuransijiwa = (CheckBox)this.findViewById(R.id.dr3cbx_asuransijiwa);
        dr3cbx_tidakada = (CheckBox)this.findViewById(R.id.dr3cbx_tidakada);
        dr3cbx_tidakdiketahui = (CheckBox)this.findViewById(R.id.dr3cbx_tidakdiketahui);
	
     
		Intent i = getIntent();
		if (i.getIntExtra("variablestatis.dr3_asuransibangunan",0)==1){
			dr3cbx_asuransibangunan.setChecked(true);
		}else{dr3cbx_asuransibangunan.setChecked(false);}
		
		if (i.getIntExtra("variablestatis.dr3_asuransibarangpersonal",0)==1){
			dr3cbx_asuransibarangpersonal.setChecked(true);
		}else{dr3cbx_asuransibarangpersonal.setChecked(false);}
		
		if (i.getIntExtra("variablestatis.dr3_asuransijiwa",0)==1){
			dr3cbx_asuransijiwa.setChecked(true);
		}else{dr3cbx_asuransijiwa.setChecked(false);}
		
		if (i.getIntExtra("variablestatis.dr3_tidakada",0)==1){
			dr3cbx_tidakada.setChecked(true);
		}else{dr3cbx_tidakada.setChecked(false);}
		
		if (i.getIntExtra("variablestatis.dr3_tidakdiketahui",0)==1){
			dr3cbx_tidakdiketahui.setChecked(true);
		}else{dr3cbx_tidakdiketahui.setChecked(false);}
		
	}

	private View.OnClickListener onSave=new View.OnClickListener() {
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.next_button4:
			
			if (dr3cbx_asuransibangunan.isChecked()) variabelstatis.dr3_asuransibangunan=" Asuransi Bangunan; "; else variabelstatis.dr3_asuransibangunan="";
			if (dr3cbx_asuransibarangpersonal.isChecked()) variabelstatis.dr3_asuransibarangpersonal=" Asuransi Barang Personal; "; else variabelstatis.dr3_asuransibarangpersonal=""; 
			if (dr3cbx_asuransijiwa.isChecked()) variabelstatis.dr3_asuransijiwa=" Asuransi Jiwa; "; else variabelstatis.dr3_asuransijiwa="";
			if (dr3cbx_tidakada.isChecked()) variabelstatis.dr3_tidakada="Tidak Ada"; else variabelstatis.dr3_tidakada="";
			if (dr3cbx_tidakdiketahui.isChecked()) variabelstatis.dr3_tidakdiketahui="Tidak Diketahui"; else variabelstatis.dr3_tidakdiketahui="";
			
			variabelstatis.dr3_asuransi = "" + variabelstatis.dr3_asuransibangunan + variabelstatis.dr3_asuransibarangpersonal + variabelstatis.dr3_asuransijiwa + variabelstatis.dr3_tidakada + variabelstatis.dr3_tidakdiketahui;
			}
			
			{ startActivity(new Intent(dr3_asuransi.this,dr4_penyebabkerusakan.class)); }
			
		}
	};
}
    